#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef double db;

#define in read()
#define pii pair<int,int>
#define fi first
#define se second
#define FILE(x) freopen(x".in","r",stdin);\
	freopen(x".out","w",stdout);
#define pb push_back

int read(){
	int x = 0,sgn = 1;char ch = getchar();
	for(;!isdigit(ch);ch = getchar()) if(ch == '-') sgn = -1;
	for(;isdigit(ch);ch = getchar()) x = (x<<1)+(x<<3)+(ch^48);
	return x*sgn;
}

const int N = 1010;

int n;
bool e[N][N];

pii rotate(int a,int b,bool inv){
	int x = 0,y = 0;
	for(int j = 1;j < n;j++) if(e[a][j] && e[b][j]) {y = j;break;}
	e[a][b] = e[b][a] = 0; e[x][y] = e[y][x] = 1;
	if(inv) return pii(x,y);
	else return pii(a,b);
}

vector<pii> solve(bool inv){
	vector<pii> res; int x,y; memset(e,0,sizeof(e));
	for(int i = 0;i < n;i++) e[i][(i+1)%n] = e[(i+1)%n][i] = 1;
	for(int i = 0;i < n-3;i++) x = in - 1,y = in - 1,e[x][y] = e[y][x] = 1;
	for(int i = 1;i < n;i++){
		if(e[0][i]) continue;
		int k = i+1; for(;;k++) if(e[0][k]) break;
		res.pb(rotate(i-1,k,inv)); i--;
	}if(inv) reverse(res.begin(),res.end());
	return res;
}

int main (){
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
#endif
	n = in;
	vector<pii> ans1 = solve(0); vector <pii> ans2 = solve(1);
	printf("%d\n",ans1.size() + ans2.size());
	for(pii d : ans1) printf("%d %d\n",d.fi+1,d.se+1);
	for(pii d : ans2) printf("%d %d\n",d.fi+1,d.se+1);
	return 0;
}

